<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class RegisterRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|string|min:2|max:22|unique:users,name',
            'username' => 'required|string|min:2|max:22',
            'email' => 'required|email|unique:App\Models\User',
            'password' => 'required|bail|min:6|max:32|confirmed',
            'password_confirmation' => 'required',
        ];
    }

    public function attributes()
    {
        return [
            'name' => '昵称',
            'email' => '邮箱',
            'password' => '密码',
            'password_confirmation' => '二次密码'
        ];
    }
}
